From 080372465b14627b4cdfa4638c8f987d9bb623d1 Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Thu, 27 Aug 2015 02:31:46 +0800 Subject: [PATCH] avoid wrong invoking from non-project directory --- src/etc/cargo.bashcomp.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/etc/cargo.bashcomp.sh b/src/etc/cargo.bashcomp.sh index 8aa12834e..21cea0cae 100644 --- a/src/etc/cargo.bashcomp.sh +++ b/src/etc/cargo.bashcomp.sh @@ -100,9 +100,12 @@ _get_examples(){ } _get_targets(){ + local CURRENT_PATH=$(_locate_manifest) + if [[ -z "$CURRENT_PATH" ]]; then + return 1 + fi local TARGETS=() local FIND_PATHS=( "/" ) - local CURRENT_PATH=$(_locate_manifest) local FIND_PATH LINES LINE while [[ "$CURRENT_PATH" != "/" ]]; do FIND_PATHS+=( "$CURRENT_PATH" ) -- 2.30.2